
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>二叉树 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="二叉树的二叉链表实现.html" />
    
    
    <link rel="prev" href="树.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    数据结构（C语言版） 复习总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1.html">
            
                <a href="../chapter1.html">
            
                    
                    第一章 绪论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter2/chapter2.html">
            
                <a href="../chapter2/chapter2.html">
            
                    
                    第二章 线性表
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter2/顺序表.html">
            
                <a href="../chapter2/顺序表.html">
            
                    
                    线性表的顺序表示和实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter2/链表.html">
            
                <a href="../chapter2/链表.html">
            
                    
                    线性表的链式表示和实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter3/chapter3.html">
            
                <a href="../chapter3/chapter3.html">
            
                    
                    第三章 栈和队列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/栈.html">
            
                <a href="../chapter3/栈.html">
            
                    
                    抽象数据类型栈的定义和实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/队列.html">
            
                <a href="../chapter3/队列.html">
            
                    
                    抽象数据类型队列的定义和实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    第四章 串
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../chapter4/串类型.html">
            
                <a href="../chapter4/串类型.html">
            
                    
                    串类型的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../chapter4/串的表示和实现.html">
            
                <a href="../chapter4/串的表示和实现.html">
            
                    
                    串的表示和实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter4/串的模式匹配算法.html">
            
                <a href="../chapter4/串的模式匹配算法.html">
            
                    
                    串的模式匹配算法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    第五章 数组和广义表
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter5/数组的定义.html">
            
                <a href="../chapter5/数组的定义.html">
            
                    
                    数组的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter5/矩阵的压缩存储.html">
            
                <a href="../chapter5/矩阵的压缩存储.html">
            
                    
                    矩阵的压缩存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter5/广义表.html">
            
                <a href="../chapter5/广义表.html">
            
                    
                    广义表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    第六章 树和二叉树
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="树.html">
            
                <a href="树.html">
            
                    
                    树的定义与基本术语
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7.2" data-path="二叉树.html">
            
                <a href="二叉树.html">
            
                    
                    二叉树
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.1" data-path="二叉树的二叉链表实现.html">
            
                <a href="二叉树的二叉链表实现.html">
            
                    
                    二叉树的二叉链表实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="遍历二叉树和线索二叉树.html">
            
                <a href="遍历二叉树和线索二叉树.html">
            
                    
                    遍历二叉树和线索二叉树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="树和森林.html">
            
                <a href="树和森林.html">
            
                    
                    树和森林
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="赫夫曼树.html">
            
                <a href="赫夫曼树.html">
            
                    
                    赫夫曼树
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    第七章 图
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter7/图.html">
            
                <a href="../chapter7/图.html">
            
                    
                    图的定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter7/图的存储结构.html">
            
                <a href="../chapter7/图的存储结构.html">
            
                    
                    图的存储结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../chapter7/图的遍历.html">
            
                <a href="../chapter7/图的遍历.html">
            
                    
                    图的遍历
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../chapter7/最小生成树.html">
            
                <a href="../chapter7/最小生成树.html">
            
                    
                    最小生成树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../chapter7/有向无环图.html">
            
                <a href="../chapter7/有向无环图.html">
            
                    
                    有向无环图的应用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../chapter8/查找.html">
            
                <a href="../chapter8/查找.html">
            
                    
                    第八章 查找
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../chapter8/静态查找表.html">
            
                <a href="../chapter8/静态查找表.html">
            
                    
                    静态查找表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../chapter8/动态查找表.html">
            
                <a href="../chapter8/动态查找表.html">
            
                    
                    动态查找表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../chapter8/哈希表.html">
            
                <a href="../chapter8/哈希表.html">
            
                    
                    哈希表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../chapter9/内部排序.html">
            
                <a href="../chapter9/内部排序.html">
            
                    
                    第九章 内部排序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../chapter9/插入排序.html">
            
                <a href="../chapter9/插入排序.html">
            
                    
                    插入排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../chapter9/选择排序.html">
            
                <a href="../chapter9/选择排序.html">
            
                    
                    选择排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../chapter9/快速排序.html">
            
                <a href="../chapter9/快速排序.html">
            
                    
                    快速排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../chapter9/归并排序和基数排序.html">
            
                <a href="../chapter9/归并排序和基数排序.html">
            
                    
                    归并排序和基数排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../chapter9/排序方法的比较.html">
            
                <a href="../chapter9/排序方法的比较.html">
            
                    
                    排序方法的比较
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >二叉树</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x4E8C;&#x53C9;&#x6811;">&#x4E8C;&#x53C9;&#x6811;</h2>
<h3 id="&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x5B9A;&#x4E49;">&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x5B9A;&#x4E49;</h3>
<p><strong>&#x4E8C;&#x53C9;&#x6811;</strong>&#xFF08;Binary Tree&#xFF09;&#x662F;&#x4E00;&#x79CD;&#x6811;&#x578B;&#x7ED3;&#x6784;&#xFF0C;&#x5B83;&#x7684;&#x7279;&#x70B9;&#x662F;&#x6BCF;&#x4E2A;&#x7ED3;&#x70B9;&#x81F3;&#x591A;&#x53EA;&#x6709;&#x4E24;&#x68F5;&#x5B50;&#x6811;&#xFF08;&#x5373;&#x4E8C;&#x53C9;&#x6811;&#x4E0D;&#x5B58;&#x5728;&#x5EA6;&#x5927;&#x4E8E; 2 &#x7684;&#x7ED3;&#x70B9;&#xFF09;&#xFF0C;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x5B50;&#x6811;&#x5177;&#x6709;&#x5DE6;&#x53F3;&#x4E4B;&#x5206;&#xFF0C;&#x5176;&#x6B21;&#x5E8F;&#x4E0D;&#x80FD;&#x4EFB;&#x610F;&#x98A0;&#x5012;&#x3002;&#x4E8C;&#x53C9;&#x6811;&#x4E0D;&#x662F;&#x6811;&#x7684;&#x7279;&#x6B8A;&#x60C5;&#x5F62;&#x3002;</p>
<p>&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x9012;&#x5F52;&#x5B9A;&#x4E49;&#x8868;&#x660E;&#x4E8C;&#x53C9;&#x6811;&#x6216;&#x4E3A;&#x7A7A;&#xFF0C;&#x6216;&#x662F;&#x7531;&#x4E00;&#x4E2A;&#x6839;&#x7ED3;&#x70B9;&#x52A0;&#x4E0A;&#x4E24;&#x68F5;&#x5206;&#x522B;&#x79F0;&#x4E3A;<strong>&#x5DE6;&#x5B50;&#x6811;</strong>&#x548C;<strong>&#x53F3;&#x5B50;&#x6811;</strong>&#x3001;&#x4E92;&#x4E0D;&#x76F8;&#x4EA4;&#x7684;&#x4E8C;&#x53C9;&#x6811;&#x7EC4;&#x6210;&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x4E8C;&#x53C9;&#x6811;&#x53EF;&#x4EE5;&#x6709; 5 &#x79CD;&#x57FA;&#x672C;&#x5F62;&#x6001;&#x3002;</p>
<p>&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x548C;&#x6EE1;&#x4E8C;&#x53C9;&#x6811;&#x662F;&#x4E24;&#x79CD;&#x7279;&#x6B8A;&#x5F62;&#x6001;&#x7684;&#x4E8C;&#x53C9;&#x6811;&#x3002;</p>
<p>&#x4E00;&#x68F5;&#x6DF1;&#x5EA6;&#x4E3A; <em>k</em> &#x4E14;&#x6709; <em>2<sup>k</sup>-1</em> &#x4E2A;&#x7ED3;&#x70B9;&#x7684;&#x4E8C;&#x53C9;&#x6811;&#x79F0;&#x4E3A;<strong>&#x6EE1;&#x4E8C;&#x53C9;&#x6811;</strong>&#x3002;&#x8FD9;&#x79CD;&#x6811;&#x7684;&#x7279;&#x70B9;&#x662F;&#x6BCF;&#x4E00;&#x5C42;&#x4E0A;&#x7684;&#x7ED3;&#x70B9;&#x6570;&#x90FD;&#x662F;&#x6700;&#x5927;&#x7ED3;&#x70B9;&#x6570;&#x3002;</p>
<p>&#x5BF9;&#x6EE1;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x7ED3;&#x70B9;&#x8FDB;&#x884C;&#x8FDE;&#x7EED;&#x7F16;&#x53F7;&#xFF0C;&#x7EA6;&#x5B9A;&#x7F16;&#x53F7;&#x4ECE;&#x6839;&#x7ED3;&#x70B9;&#x8D77;&#xFF0C;&#x81EA;&#x4E0A;&#x800C;&#x4E0B;&#xFF0C;&#x81EA;&#x5DE6;&#x81F3;&#x53F3;&#x3002;&#x6DF1;&#x5EA6;&#x4E3A; <em>k</em> &#x7684;&#xFF0C;&#x6709; <em>n</em> &#x4E2A;&#x7ED3;&#x70B9;&#x7684;&#x4E8C;&#x53C9;&#x6811;&#xFF0C;&#x5F53;&#x4E14;&#x4EC5;&#x5F53;&#x5176;&#x6BCF;&#x4E00;&#x4E2A;&#x7ED3;&#x70B9;&#x90FD;&#x4E0E;&#x6DF1;&#x5EA6;&#x4E3A; <em>k</em> &#x7684;&#x6EE1;&#x4E8C;&#x53C9;&#x6811;&#x4E2D;&#x7F16;&#x53F7;&#x4ECE; 1 &#x81F3; <em>n</em> &#x7684;&#x7ED3;&#x70B9;&#x4E00;&#x4E00;&#x5BF9;&#x5E94;&#x65F6;&#xFF0C;&#x79F0;&#x4E3A;<strong>&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;</strong>&#x3002;&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x7279;&#x70B9;&#x662F;&#xFF1A;</p>
<ol>
<li>&#x53F6;&#x5B50;&#x7ED3;&#x70B9;&#x53EA;&#x53EF;&#x80FD;&#x5728;&#x5C42;&#x6B21;&#x6700;&#x5927;&#x7684;&#x4E24;&#x5C42;&#x4E0A;&#x51FA;&#x73B0;&#xFF1B;</li>
<li>&#x5BF9;&#x4EFB;&#x4E00;&#x7ED3;&#x70B9;&#xFF0C;&#x82E5;&#x5176;&#x53F3;&#x5206;&#x652F;&#x4E0B;&#x5B50;&#x5B59;&#x7684;&#x6700;&#x5927;&#x5C42;&#x6B21;&#x4E3A; <em>l</em>&#xFF0C;&#x5219;&#x5176;&#x5DE6;&#x5206;&#x652F;&#x4E0B;&#x5B50;&#x5B59;&#x7684;&#x6700;&#x5927;&#x5C42;&#x6B21;&#x5FC5;&#x4E3A; <em>l</em> &#x6216; <em>l+1</em>&#x3002;</li>
</ol>
<h3 id="&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6027;&#x8D28;">&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6027;&#x8D28;</h3>
<p><strong>&#x6027;&#x8D28; 1</strong> &#x5728;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x7B2C; <em>i</em> &#x5C42;&#x4E0A;&#x81F3;&#x591A;&#x6709; <em>2<sup> i-1</sup> (i&gt;=1)</em> &#x4E2A;&#x7ED3;&#x70B9;&#x3002;</p>
<p><strong>&#x6027;&#x8D28; 2</strong> &#x6DF1;&#x5EA6;&#x4E3A; <em>k</em> &#x7684;&#x7ED3;&#x70B9;&#x81F3;&#x591A;&#x6709; <em>2<sup> k</sup>-1(k&gt;=1)</em> &#x4E2A;&#x7ED3;&#x70B9;&#x3002;</p>
<p><strong>&#x6027;&#x8D28; 3</strong> &#x5BF9;&#x4EFB;&#x4F55;&#x4E00;&#x68F5;&#x4E8C;&#x53C9;&#x6811; <em>T</em>&#xFF0C;&#x5982;&#x679C;&#x5176;&#x7EC8;&#x7AEF;&#x7ED3;&#x70B9;&#x6570;&#x4E3A; <em>n<sub>0</sub></em>&#xFF0C;&#x5EA6;&#x4E3A; 2 &#x7684;&#x7ED3;&#x70B9;&#x6570;&#x4E3A; <em>n<sub>2</sub></em>&#xFF0C;&#x5219; <em>n<sub>0</sub>=n<sub>2</sub>+1</em>&#x3002;</p>
<p><strong>&#x6027;&#x503C; 4</strong> &#x5177;&#x6709; <em>n</em> &#x4E2A;&#x7ED3;&#x70B9;&#x7684;&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6DF1;&#x5EA6;&#x4E3A; <em>[log<sub>2</sub> n]+1</em> <sup>&#x2460;</sup>&#x3002;
&#x7279;&#x6B8A;&#x5F62;&#x6001;&#x7684;&#x4E8C;&#x53C9;&#x6811;</p>
<p><strong>&#x6027;&#x8D28; 5</strong> &#x5982;&#x679C;&#x5BF9;&#x4E00;&#x68F5;&#x6709; <em>n</em> &#x4E2A;&#x7ED3;&#x70B9;&#x7684;&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x7ED3;&#x70B9;&#x6309;&#x5C42;&#x5E8F;&#x7F16;&#x53F7;&#xFF0C;&#x5219;&#x5BF9;&#x4EFB;&#x4E00;&#x7ED3;&#x70B9; <em>i(1&lt;=i&lt;=n)</em>&#xFF0C;&#x6709;&#xFF1A;</p>
<ol>
<li>&#x5982;&#x679C; <em>i=1</em>&#xFF0C;&#x5219;&#x7ED3;&#x70B9; <em>i</em> &#x662F;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6839;&#xFF0C;&#x65E0;&#x53CC;&#x4EB2;&#xFF1B;&#x5982;&#x679C; <em>i&gt;1</em>&#xFF0C;&#x5219;&#x5176;&#x53CC;&#x4EB2;&#x662F; <em>[i/2]</em> <sup>&#x2460;</sup>&#x3002;</li>
<li>&#x5982;&#x679C; <em>2i&gt;n</em>&#xFF0C;&#x5219;&#x7ED3;&#x70B9; <em>i</em> &#x65E0;&#x5DE6;&#x5B69;&#x5B50;&#xFF08;&#x7ED3;&#x70B9; <em>i</em> &#x4E3A;&#x53F6;&#x5B50;&#x7ED3;&#x70B9;&#xFF09;&#xFF1B;&#x5982;&#x679C; <em>2i&lt;=n</em>&#xFF0C;&#x5219;&#x5176;&#x5DE6;&#x5B69;&#x5B50;&#x662F; <em>2i</em>&#x3002;</li>
<li>&#x5982;&#x679C; <em>2i+1&gt;n</em>&#xFF0C;&#x5219;&#x7ED3;&#x70B9; <em>i</em> &#x65E0;&#x53F3;&#x5B69;&#x5B50;&#xFF1B;&#x5982;&#x679C; <em>2i+1&lt;=n</em>&#xFF0C;&#x5219;&#x5176;&#x53F3;&#x5B69;&#x5B50;&#x662F; <em>2i+1</em>&#x3002;</li>
</ol>
<blockquote>
<p>&#x2460; &#x7B26;&#x53F7; <code>[x]</code> &#x8868;&#x793A;&#x53D6;&#x6574;&#x7B26;&#x53F7;&#x3002;</p>
</blockquote>
<h3 id="&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x5B58;&#x50A8;&#x7ED3;&#x6784;">&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x5B58;&#x50A8;&#x7ED3;&#x6784;</h3>
<p><strong>&#x987A;&#x5E8F;&#x5B58;&#x50A8;&#x7ED3;&#x6784;</strong></p>
<pre><code class="lang-C"><span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> MAX_TREE_SIZE 20 <span class="hljs-comment">// &#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6700;&#x5927;&#x7ED3;&#x70B9;&#x6570;</span></span>

<span class="hljs-keyword">typedef</span> <span class="hljs-keyword">struct</span>
{
    ElemType data[MAX_TREE_SIZE];
    <span class="hljs-keyword">int</span> n; <span class="hljs-comment">// &#x7ED3;&#x70B9;&#x4E2A;&#x6570;</span>
}SqBiTree;
</code></pre>
<ul>
<li>&#x5C06;&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x4E0A;&#x7F16;&#x53F7;&#x4E3A; <em>i</em> &#x7684;&#x7ED3;&#x70B9;&#x5143;&#x7D20;&#x5B58;&#x50A8;&#x5728;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;&#x4E2D;&#x4E0B;&#x6807;&#x4E3A; <em>i-1</em> &#x7684;&#x5206;&#x91CF;&#x4E2D;&#x3002;</li>
<li>&#x5BF9;&#x4E8E;&#x4E00;&#x822C;&#x4E8C;&#x53C9;&#x6811;&#xFF0C;&#x5219;&#x5C06;&#x5176;&#x6BCF;&#x4E2A;&#x7ED3;&#x70B9;&#x4E0E;&#x5B8C;&#x5168;&#x4E8C;&#x53C9;&#x6811;&#x4E0A;&#x7684;&#x7ED3;&#x70B9;&#x76F8;&#x5BF9;&#x7167;&#xFF0C;&#x5B58;&#x50A8;&#x5728;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x76F8;&#x5E94;&#x5206;&#x91CF;&#x4E2D;&#x3002;</li>
<li>0 &#x8868;&#x793A;&#x4E0D;&#x5B58;&#x5728;&#x6B64;&#x7ED3;&#x70B9;&#x3002;</li>
</ul>
<p><strong>&#x94FE;&#x5F0F;&#x5B58;&#x50A8;&#x7ED3;&#x6784;</strong></p>
<p>&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x7ED3;&#x70B9;&#x7531;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5143;&#x7D20;&#x548C;&#x5206;&#x522B;&#x6307;&#x5411;&#x5176;&#x5DE6;&#x3001;&#x53F3;&#x5B50;&#x6811;&#x7684;&#x4E24;&#x4E2A;&#x5206;&#x652F;&#x6784;&#x6210;&#xFF0C;&#x5219;&#x8868;&#x793A;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x94FE;&#x8868;&#x4E2D;&#x7684;&#x7ED3;&#x70B9;&#x81F3;&#x5C11;&#x5305;&#x542B; 3 &#x4E2A;&#x57DF;&#xFF1A;&#x6570;&#x636E;&#x57DF;&#x548C;&#x5DE6;&#x3001;&#x53F3;&#x6307;&#x9488;&#x57DF;&#x3002;&#x6709;&#x65F6;&#x4E3A;&#x4E86;&#x65B9;&#x4FBF;&#x627E;&#x5230;&#x7ED3;&#x70B9;&#x7684;&#x53CC;&#x4EB2;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x5728;&#x7ED3;&#x70B9;&#x7ED3;&#x6784;&#x4E2D;&#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x6307;&#x5411;&#x5176;&#x53CC;&#x4EB2;&#x7ED3;&#x70B9;&#x7684;&#x6307;&#x9488;&#x57DF;&#x3002;&#x8FD9;&#x4E24;&#x79CD;&#x5B58;&#x50A8;&#x7ED3;&#x6784;&#x5206;&#x522B;&#x79F0;&#x4E3A;<strong>&#x4E8C;&#x53C9;&#x94FE;&#x8868;</strong>&#x548C;<strong>&#x4E09;&#x53C9;&#x94FE;&#x8868;</strong>&#x3002;</p>
<pre><code class="lang-C"><span class="hljs-keyword">typedef</span> <span class="hljs-keyword">struct</span> BiTNode
{
    ElemType data;
    <span class="hljs-keyword">struct</span> BiTNode *lchild, *rchild; <span class="hljs-comment">// &#x5DE6;&#x53F3;&#x5B69;&#x5B50;&#x6307;&#x9488;</span>
<span class="hljs-comment">//  struct BiTNode *parent; //&#x4E09;&#x53C9;&#x94FE;&#x8868;</span>
}BiTNode, *BiTree;
</code></pre>
<blockquote>
<p>&#x94FE;&#x8868;&#x7684;&#x5934;&#x6307;&#x9488;&#x6307;&#x5411;&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x6839;&#x7ED3;&#x70B9;&#xFF0C;&#x5728;&#x542B;&#x6709; <em>n</em> &#x4E2A;&#x7ED3;&#x70B9;&#x7684;&#x4E8C;&#x53C9;&#x94FE;&#x8868;&#x4E2D;&#x6709; <em>n+1</em> &#x4E2A;&#x7A7A;&#x94FE;&#x57DF;&#xFF0C;&#x4E3B;&#x8981;&#x662F;&#x7EC8;&#x7AEF;&#x7ED3;&#x70B9;&#x4EA7;&#x751F; 2 &#x4E2A;&#xFF0C;&#x5EA6;&#x4E3A; 1 &#x7684;&#x7ED3;&#x70B9;&#x4EA7;&#x751F; 1 &#x4E2A;&#x3002;</p>
</blockquote>
<p><a href="&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x4E8C;&#x53C9;&#x94FE;&#x8868;&#x5B9E;&#x73B0;.html">&#x4E8C;&#x53C9;&#x6811;&#x7684;&#x4E8C;&#x53C9;&#x94FE;&#x8868;&#x5B9E;&#x73B0;</a></p>
<blockquote>
<p>&#x4E8C;&#x53C9;&#x6392;&#x5E8F;&#x6811;&#x7684;&#x77E5;&#x8BC6;&#x89C1;&#x7B2C;&#x516B;&#x7AE0; <a href="../chapter8/&#x52A8;&#x6001;&#x67E5;&#x627E;&#x8868;.html">&#x52A8;&#x6001;&#x67E5;&#x627E;&#x8868;</a>&#x3002;</p>
</blockquote>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="树.html" class="navigation navigation-prev " aria-label="Previous page: 树的定义与基本术语">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="二叉树的二叉链表实现.html" class="navigation navigation-next " aria-label="Next page: 二叉树的二叉链表实现">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"二叉树","level":"1.7.2","depth":2,"next":{"title":"二叉树的二叉链表实现","level":"1.7.2.1","depth":3,"path":"chapter6/二叉树的二叉链表实现.md","ref":"chapter6/二叉树的二叉链表实现.md","articles":[]},"previous":{"title":"树的定义与基本术语","level":"1.7.1","depth":2,"path":"chapter6/树.md","ref":"chapter6/树.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter6/二叉树.md","mtime":"2018-08-27T02:11:03.980Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T10:05:33.540Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

